<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript">
			//超时调用
			//只调用1次
			//setTimeout(function(){alert("yes")},8000);
			
			/*
			//间歇调用
			var i = 0;
			var id = setInterval(function(){
				i++;
				console.log("i=" + i);
				
				//判断变量i的次数，如果i==5执行clearInterval()
				if(i==5)
					//(按Id)清除间歇调用
					clearInterval(id);
			},5000);
			*/
			
			window.onload=function(){
				setInterval(function(){
					document.getElementById("time").innerText=new Date().toLocaleTimeString();
				},1000);
			}
		</script>
	</head>
	<body>
		<span id="time"></span>
	</body>
</html>
